<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>权限分配案例</title>
    <style>
        body{
            display: flex;
        }

        div{
            display: flex;
            flex-direction: column;
        }
        button{
            margin:5px 10px;
        }
        select{
            width: 300px;
            font-size: 18px;
            height: 200px;
        }
    </style>
</head>
<script src="../libs/jquery3_1_1.min.js"></script>

<script>
    $(function () {
        $('button:eq(0)').on('click',function () {
            $('#left-sel option').appendTo('#right-sel');
        }).next().on('click',function () {
            $('#right-sel option').appendTo('#left-sel');
        }).next().on('click',function () {
            $('#left-sel option:selected').appendTo('#right-sel');
            //清除选中项
        }).next().on('click',function () {
            $('#right-sel option:selected').appendTo('#left-sel');
        })
    });
</script>
<body>
    <select size="5" multiple id="left-sel">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
    </select>
        <div class="btn-box">
            <button>&gt;&gt;</button>
            <button>&lt;&lt;</button>
            <button>&gt;</button>
            <button>&lt;</button>
        </div>
    <select size="5" multiple id="right-sel">
    </select>
</body>
</html>